<?php
namespace Fwadmin\Controller;
use Think\Controller;
class IndexController extends BaseController{
    public function index(){
		$map['username'] = array('EQ', cookie('yz_name'));
		$typeids = M('Manage') -> where($map) -> getField('typeids');
		$nav = nav($typeids);
		$this -> assign('menu', $nav);
		$this -> display();
    }
	public function main(){
		$time = date('Y年n月j日 H:i:s');
		$ServerInfo = array(
			'运行环境'		=> $_SERVER['SERVER_SOFTWARE'],
			'服务器端口'		=> $_SERVER['SERVER_PORT'],
			'PHP版本'		=> PHP_VERSION,
			'PHP运行方式'	=> php_sapi_name(),
			'Mysql版本'		=> $this -> _mysql_version(),
			'上传附件限制'	=> ini_get('file_uploads') ? ini_get('upload_max_filesize') : 'Disabled',
			'执行时间限制'	=> ini_get('max_execution_time') . '秒',
			'剩余空间'		=> round((@disk_free_space(".") / (1024 * 1024)), 2) . 'M',
			'程序版本'		=> 'V3.0',
		);
		$this -> assign('time', $time);
		$this -> assign('server_info', $ServerInfo);
		$this -> display('main');
	}
	private function _mysql_version(){
		$model = new \Think\Model();
		$v = $model->query("select VERSION() as ver");
		return $v[0]['ver'];
	}
}